package com.zysc.processflow.controller;


import com.zysc.processflow.common.base.ResultBody;
import com.zysc.processflow.entity.Handletask;
import com.zysc.processflow.service.IHandletaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.zysc.processflow.common.base.BaseController;

/**
 * <p>
 * 处置任务表 前端控制器
 * </p>
 *
 * @author 正元智慧城市_
 * @since 2022-11-23
 */
@Api(value = "处置任务", tags = "处置任务")
@RestController
@RequestMapping("/handletask")
public class HandletaskController extends BaseController<Handletask> {

    @Autowired
    IHandletaskService service;

    public HandletaskController(IHandletaskService service) {
        super(service);
    }



    @ApiOperation("添加/更新任务实体")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "任务实体", name = "entity", dataType = "Handletask")
    })

    @Transactional
    @PostMapping(value = "SaveOrUpdate")
    public ResultBody SaveOrUpdate(@RequestBody Handletask entity) {
        Boolean b = service.saveOrUpdate(entity);
        if(b){
            return ResultBody.Success(entity);
        }else {
            return ResultBody.error("添加/更新数据失败", 500);
        }
    }
}
